import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
import Login from '@/components/login'

Vue.use(Router)

let router = new Router({
  // mode:"history",
  routes: [
    {
      path: '/',
      name: 'login',
      component: s => require.ensure([],()=>s(require('@/components/login')),'login')
    },
    {
      path: '/agree',
      name: 'agree',
      component:s => require.ensure([],()=>s(require('@/components/agree')),'agree')
    },
    {
      path: '/update/:userId',
      name: 'update',
      component:s => require.ensure([],()=>s(require('@/components/info/update')),'update')
    },
    {
      path: '/payment',
      name: 'payment',
      component:s => require.ensure([],()=>s(require('@/components/payment')),'payment')
    },
    {
      path: '/pay/:orderId',
      name: 'pay',
      component:s => require.ensure([],()=>s(require('@/components/pay')),'pay')
    },
    {
      path: '/userInfo',
      name: 'userInfo',
      component:s => require.ensure([],()=>s(require('@/components/userInfo')),'userInfo')
    },
    {
      path: '/noAgree',
      name: 'noAgree',
      component:s => require.ensure([],()=>s(require('@/components/agree/noAgree')),'noAgree')
    },
    {
      path: '*',
      name: '404',
      component:s => require.ensure([],()=>s(require('@/components/commons/404')),'404')
    }
  ]
})
//
router.beforeEach((to, from, next) => {
  console.log('beforeEach');
  next()
})

export default router;
